{% liquid
  for block in blocks
    if forloop.first
      if block.settings.channel_logo != blank 
        assign has_logo = true
      endif
    endif
  endfor
%}
<div class="as-sales-channel-modal sales-channel-modal modal fade" id="sales-channel-modal-for-{{ section_name }}" tabindex="-1" aria-labelledby="salesChannelModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content border-0">
      <div class="py-4 border-bottom">
        <div class="text-center h5 fw-bolder mb-0">{{ 'sections.sticky_navbar.where_to_buy' | t }}</div>
        <button type="button" class="btn p-0 as-close btn-close btn-modal-close icon-wrap-md position-absolute" data-bs-dismiss="modal" aria-label="Close">
          {% render 'icon-close-circle' %}
        </button>
      </div>
      <div class="modal-body text-center px-8 pb-5 pt-0">
        {% for block in blocks %}
          {% if has_logo %}
            {% if block.settings.channel_logo != blank %}
              <div class="mt-5 position-relative">
                <img class="object-fit-cover logo-img" src="{{ block.settings.channel_logo | img_url: 'master' }}" alt="{{ block.settings.channel_logo.alt | escape }}" loading="lazy">
                {% if block.settings.channel_link != blank %}
                  <a class="stretched-link" href="{{ block.settings.channel_link }}" target="_blank"></a>
                {% endif %}
              </div>
            {% endif %}
          {% else %}
            {%- if block.settings.title != blank -%}
              {% if section_name == 'stikcy-navbar' %}
                {% liquid
                  case block.settings.button_color
                    when 'light'
                      assign btn_style = 'link-light btn-link'
                    when 'dark'
                      assign btn_style = 'link-dark btn-link'
                    when 'accent1'
                      assign btn_style = 'link-primary btn-link'
                  endcase
                %}
              {% elsif section_name == 'product' %}
                {% liquid
                  case block.settings.text_color
                    when 'white'
                      assign btn_style = 'link-light btn-link'
                    when 'black'
                      assign btn_style = 'link-dark btn-link'
                  endcase
                %}
              {% endif %}
              <div class="mt-6">
                {%- if block.settings.channel_link != blank -%}
                  <a {% render 'link', link: block.settings.channel_link %} href="{{ block.settings.channel_link }}" class="btn {{ btn_style }} flex-nowrap fs-4 fw-bolder" target="_blank">
                    {{ block.settings.title }}
                  </a>
                {%- else -%}
                  <div class="btn {{ btn_style }} flex-nowrap disabled cursor-default fs-4 fw-bolder">
                    {{ block.settings.title }}
                  </div>
                {%- endif -%}
              </div>
            {%- endif -%}
          {% endif %}
        {% endfor %}
      </div>
    </div>
  </div>
</div>